<?php

/**
 * Plan filter form base class.
 *
 * @package    faceshop
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasePlanFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'                  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'period'                => new sfWidgetFormChoice(array('choices' => array('' => '', 'month' => 'month', 'year' => 'year'))),
      'label'                 => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'display_order'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'upgrade_order'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'subscription_offer_id' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'salesforce_id'         => new sfWidgetFormFilterInput(),
      'cost'                  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'extra_credit'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'job_slots'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'is_active'             => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_customizable'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_import_auto'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_api_enabled'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_engines_enabled'    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_cost_public'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'features'              => new sfWidgetFormFilterInput(),
      'created_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'name'                  => new sfValidatorPass(array('required' => false)),
      'period'                => new sfValidatorChoice(array('required' => false, 'choices' => array('month' => 'month', 'year' => 'year'))),
      'label'                 => new sfValidatorPass(array('required' => false)),
      'display_order'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'upgrade_order'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'subscription_offer_id' => new sfValidatorPass(array('required' => false)),
      'salesforce_id'         => new sfValidatorPass(array('required' => false)),
      'cost'                  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'extra_credit'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'job_slots'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_active'             => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_customizable'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_import_auto'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_api_enabled'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_engines_enabled'    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_cost_public'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'features'              => new sfValidatorPass(array('required' => false)),
      'created_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('plan_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Plan';
  }

  public function getFields()
  {
    return array(
      'plan_id'               => 'Number',
      'name'                  => 'Text',
      'period'                => 'Enum',
      'label'                 => 'Text',
      'display_order'         => 'Number',
      'upgrade_order'         => 'Number',
      'subscription_offer_id' => 'Text',
      'salesforce_id'         => 'Text',
      'cost'                  => 'Number',
      'extra_credit'          => 'Number',
      'job_slots'             => 'Number',
      'is_active'             => 'Boolean',
      'is_customizable'       => 'Boolean',
      'is_import_auto'        => 'Boolean',
      'is_api_enabled'        => 'Boolean',
      'is_engines_enabled'    => 'Boolean',
      'is_cost_public'        => 'Boolean',
      'features'              => 'Text',
      'created_at'            => 'Date',
      'updated_at'            => 'Date',
    );
  }
}
